<?php
/**
 * 权限管理
 *
 */
$user_id = $_SESSION['sys']['username'];
if (count($_POST)) {
	$user_id = $_POST['user_id'];
	if($user_id != 'admin') {
		$userMenu = $menu->deMenu($_POST['p_menu'], $_menus);
		$userMenu = var_export($userMenu,true);
		$path = $menu->getMenuPath($user_id);
		file_put_contents($path, "<?php\nreturn $userMenu;\n?>");
		echo 'Ok';
	}
}
if($_GET['id']) {
	$_GET['id'] = (int) $_GET['id'];
	$user = $db->rows('SELECT username FROM admin_users WHERE id="'.$_GET['id'].'"');
	$userPermission = $menu->getMenu($user['username']);
	$user_id = $user['username'];
}


Basic :: setModelFile('head');
Basic :: setModelFile('permission');
Basic :: setModelFile('bottom');
$tpl->p('permission');

?>